/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uttt.edu.mx.datos;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.List;
import uttt.edu.mx.conexion.Conexion;
import uttt.edu.mx.entidades.EntIngresarPago;

/**
 *
 * @author Jesus Santiago
 */
public class CtrlPagos implements IGeneral {

    private PreparedStatement st = null;
    private Connection conn;

    @Override
    public boolean insertar(Object _Obj) {
        EntIngresarPago grupo = (EntIngresarPago) _Obj;
        try {
            Conexion datos = new Conexion();
            Connection conn = datos.getConexion();
            if (conn != null) {
                String query = "INSERT INTO pagos (id_Persona, fecha_Pago, total_Pago, id_Promocion) "
                        + " VALUES (" + grupo.getId()
                        + " , '" + grupo.getFechaAPagar()
                        + "' , '" + grupo.getMonto()
                        + "' , '" + grupo.getPromocion() + "');";
                st = conn.prepareStatement(query);
                int executeUpdate = st.executeUpdate();
                return true;
            } else {
                return false;
            }
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
            return false;
        }}

    @Override
    public boolean eliminar(Object _Obj) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public List<Object> consultar(Object _Obj) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean modificar(Object _Obj) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}
